#include <stdio.h>

#include "grate/antidictionary.h"
#include "grate/calculator.h"

// Define your own rules for building the set of forbidden words for
// a language.
class MyAntiDictionary : public growth_rate::LexminAntiDictionary {
 public:
  // Define trie for ternary alphabet with sufficient number of nodes.
  // Number of nodes is at most total length of all forbidden words stored
  // in a trie.
  MyAntiDictionary() : LexminAntiDictionary(100, 3) { }
 private:
  bool construct() {
    // Forbid factor of the form "aaa" where "a" may be any of three
    // letters in the alphabet.
    add_lexmin_word("aaa");
    return true;
  }
};

int main() {
  // Create a generator of set of forbidden words.
  MyAntiDictionary *AD = new MyAntiDictionary();
  // Use the default algorithm to calculate the growth rate of a language
  // defined by the set of forbidden factors in MyAntiDictionary.
  double grate = growth_rate::Calculator::get_language_growth_rate(AD);
  printf("Growth rate: %lf\n", grate);
  return 0;
}
